package com.qianfeng.smartdevice.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @time: 2022-03-14 19:08
 */
public class MyStringUtils {

    public static final String mobileRegex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(16[5,6])|(17[0-8])|(18[0-9])|(19[1、5、8、9]))\\d{8}$";
    public static final String emaiRegex = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    public static boolean check(String content, String regex) {
        Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(content);
        return m.matches();
    }

}
